const express = require('express');
let router = express.Router();

/*** 按发布时间逆序返回新闻列表 ***/
router.get('/list/:pageNum', (req,res) => {
    // 读取请求数据
    let n = req.params.pageNum;

    // 输出响应信息
    let pager = {pageNum: n};

    res.json(pager);
});

/**
 * 根据新闻ID返回新闻详情
 */
router.get('/:nid', (req, res) => {
    let nid = req.params.nid;

    res.json({nid, title: "title" + nid});
});

module.exports = router;